import Vue from 'vue';
import VueRouter from 'vue-router';

// 引入组件
import Header from './components/common/Header.vue';
import Recom from './components/recom/Recom.vue';
import Toplist from './components/toplist/Toplist.vue';
import Search from './components/search/Search.vue';

import Board from './components/toplist/Board.vue';
import Playsong from './components/toplist/Playsong.vue';

Vue.use(VueRouter);

export default new VueRouter({
    routes: [
        {
            path: '/',
            component: Header,
            redirect: '/recom',
            children: [
                {
                    path: 'recom',
                    component: Recom
                },
                {
                    path: 'toplist',
                    component: Toplist
                },
                {
                    path: 'search',
                    component: Search
                },
            ]
        },
        {
            path: '/board/:topid/:topname',
            name: 'board',
            component: Board
        },
        {
            path: '/playsong/:playIndex/:songIds',
            name: 'playsong',
            component: Playsong
        },
        {
            path: '*',
            redirect: '/recom'
        }
    ]
})